package cn.thread;

public class ForTest {
public static void main(String args[]){
    Brother b=new Brother();
    b.start();
}
}
class Brother extends Thread{
    @Override
    public void run() {

     Thread s=new Thread(new Sister());
        try {
            s.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
     s.start();

        for (int i=0;i<10;i++){

            System.out.println("Brother的"+i);
        }
    }
}
class Sister extends Thread{
    @Override
    public void run() {
        Thread b=new Thread(new Brother());
        try {
            b.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i=0;i<10;i++){

            System.out.println("Sister的"+i);
        }
    }
}
